-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port already in use #279
Port already in use #279
Conversation
This PR is ready for a first round of reviews and feedback. Summary:
It depends on the kernel implementation whether that addresses the port-in-use problem. If a kernel first gets all ports and does not respond to heartbeats unless that succeeds, it will be restarted with new ports. But if there are kernel implementations out there which respond to a heartbeat and therefore appear alive, although they couldn't get one of the other ports, they will be restarted with the same ports. But there's only so much that can be detected on the Jupyter client side. |
Nice! I think this is a good idea. We will have to think a little bit carefully about when newports is invoked automatically to avoid breaking things in surprising ways. In particular, we should check what's going to happen in the notebook when this event occurs. What I would like to avoid is this sequence of events:
This would be frustrating and confusing to have everything claim to be working, but have execution silently fail. It's okay if this is the starting point because it's replacing an already broken case of a dead kernel, but I want to make sure that the right notifications/events are in place to handle it better in the notebook (i.e. ensure that connected channels reconnect to the new ports). |
@minrk: Thanks for having a look. I agree that we need to think through some error scenarios. The websocket channel connects to the notebook server, not to the kernel, right? |
@rolweber when a websocket connects to the server, a corresponding zmq socket is connected from the server to the kernel. I want to know what will happen if the connection happens before the restart (i.e. is it possible that the zmq socket is connected to the first port and not the new port). |
I studied the code of class
Without the change I'm proposing here, the ZMQ connections between the notebook server and the kernel already have to be re-established, because they were dropped when the old kernel got killed. With my change, re-establishing connections will pick up the new port numbers. Disclaimer: AFAICT. |
The |
If we feel it is safe, we could also set the default to the new behavior and keep the config parameter only as a fallback in case of unexpected problems. |
I'm back from vacation. Any suggestions on how I can move this PR further towards merging? |
Thanks for your detailed look into the notebook behavior! I think we can make this True by default based on your findings. Then I think it's good to go. |
Thanks for reviewing! I switched the default. |
See issue #276.